using System.ComponentModel.DataAnnotations;

namespace MonitorPlatform.Data.Entities
{
    public class PerformanceMetric : BaseEntity
    {
        [Required]
        [StringLength(50)]
        public string AppId { get; set; } = string.Empty;

        [Required]
        [StringLength(100)]
        public string SessionId { get; set; } = string.Empty;

        [StringLength(100)]
        public string? UserId { get; set; }

        [StringLength(500)]
        public string? Url { get; set; }

        public DateTime Timestamp { get; set; }

        // Core Web Vitals
        public double? FirstContentfulPaint { get; set; }
        public double? LargestContentfulPaint { get; set; }
        public double? FirstInputDelay { get; set; }
        public double? CumulativeLayoutShift { get; set; }
        public double? TimeToFirstByte { get; set; }

        // Load Performance
        public double? DomContentLoaded { get; set; }
        public double? LoadComplete { get; set; }
        public double? ResourceLoadTime { get; set; }

        // Memory and Resource Usage
        public long? UsedJSHeapSize { get; set; }
        public long? TotalJSHeapSize { get; set; }
        public long? JSHeapSizeLimit { get; set; }

        // Device and Browser Information
        [StringLength(500)]
        public string? UserAgent { get; set; }

        [StringLength(50)]
        public string? DeviceType { get; set; }

        [StringLength(50)]
        public string? Os { get; set; }

        [StringLength(50)]
        public string? Browser { get; set; }

        [StringLength(20)]
        public string? BrowserVersion { get; set; }

        [StringLength(20)]
        public string? ScreenResolution { get; set; }

        [StringLength(20)]
        public string? ViewportSize { get; set; }

        // Network Information
        [StringLength(20)]
        public string? ConnectionType { get; set; }

        [StringLength(20)]
        public string? EffectiveType { get; set; }

        public double? DownlinkSpeed { get; set; }
        public double? Rtt { get; set; }

        // Geographic Information
        [StringLength(50)]
        public string? Country { get; set; }

        [StringLength(50)]
        public string? Region { get; set; }

        [StringLength(50)]
        public string? City { get; set; }

        // Navigation properties
        public virtual Application Application { get; set; } = null!;
    }
} 